
import glob
import re
import string
import codecs
import pepe.p_txt.bigtxt as bt

n = '\x0D\x0A'

def main():
    ''' '''

    DEBUG_MODE = False

    o = open('output.dat', 'wb')
    #o.write('...' + crlf)
    d = open('dropped.dat', 'wb')

    pf_masks = [
    r""" """,
    ]

    for pf_mask in pf_masks:
    
        print pf_mask

        #for inpfile in glob.glob('*.txt'):
        for f in glob.glob(pf_mask):

            fname = string.split(f, '\x5C')[-1]
            #pathfname = f[f.find('...'):] # cutting path at some know point
            print fname

            for line in bt.lines(f):

                line = re.sub(n, '', line)

                if re.search('\d{7}', line[:7]) and len(line.split('	')) == 24:
                    o.write(f[:13]+'	'+line + n)
                else:
                    d.write(f[:13]+'	'+line + n)

    o.close()
    d.close()

if __name__ == "__main__":
    ''' '''
    if  len(sys.argv) == 2:
        main(sys.argv[1])
    else:
        print """
        """
